/* 侯捷 c++第三课 */
#include <iostream>
using namespace std;

template<typename T>
class identity {
public:
    identity() : data(0) { cout<< "identity::identity()" << endl; }
    identity(T x) : data(x) { cout<< "identity::identity(T x)" << endl; }
    const T& operator()(const T& x) const { 
        cout << "identity::operator() " << data << endl;
        return x;
    }
private:
    T data;
};

int main(int argc, char **argv)
{
    cout << "======= start =========" << endl;

    identity<int> id1;
    id1(1);
    identity<int> id2(10);
    id2(1);

    cout << "======== end ==========" << endl;
    return 0;
}
